﻿using System;

using HsTec.Mobile.Green.BLL;
using System.Web.UI.WebControls;

public partial class PowerWarning_Weight_Manage : System.Web.UI.Page
{
    private WeightBLL bll = new WeightBLL();

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Indicator.Text = Request.QueryString["sIndicator"].ToString();
        }
        catch
        {
        }
        if (!this.IsPostBack)
        {
            this.BindGridViewData();
        }
    }
    protected string GetSearchString()
    {
        string searchStr = string.Empty;

        string sYear = sltYear.Value.ToString().Trim();

        if (sYear != "")
        {
            searchStr += " Years like'%" + sYear + "%' ";
        }

        return searchStr;
    }
    protected void BindGridViewData()
    {
        GridView1.DataSource = bll.GetList(GetSearchString());
        GridView1.DataBind();
        this.HiddenID.Value = "";
    }

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

    }
    protected void linkBtnGo_Click(object sender, EventArgs e)
    {

    }
    protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
    {

    }
    protected void btnRefresh_Click(object sender, EventArgs e)
    {
        BindGridViewData();
    }
    protected void btnTemplate_Click(object sender, EventArgs e)
    {
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(HiddenID.Value.Trim()))
        {
            bll.Delete(HiddenID.Value.TrimEnd(','));
            BindGridViewData();
        }
    }
}
